package com.example.springEvent;

import com.alibaba.fastjson.JSON;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

import java.io.*;

/**
 *
 * @author Administrator
 * @date 2020-2-5 0005
 */
@Service
public class EventObjectListener {

    @EventListener
    private void EventObjectHandler(EventObject eventObject){
        String thName= Thread.currentThread().getName()+"-"+Thread.currentThread().getId();
        System.out.println("thName:"+thName+" get eventObject: "+ JSON.toJSONString(eventObject));
    }
}
